<div class="pageContent">
	<div class="pageFormContent" layoutH="60">
  <ul class="tree treeFolder treeCheck expand" oncheck="gettreevalue">
    <?
    
    showcatlist($catlist);
    
    $jsstr=json_encode($seledcat);
    ?>
    </ul>
	</div>
	<div class="formBar">
		<ul>
            <li><div class="button"><div class="buttonContent"><button type="button" multLookup="resultBox" warn="请选择栏目">确定</button></div></div></li>
			<li><div class="button"><div class="buttonContent"><button class="close" type="button">关闭</button></div></div></li>
		</ul>
	</div>
</div>
<input type="hidden" name="resultBox" id="resultBox" value='<?=$jsstr?>' />

<script type="text/javascript">
function HashTable() 
{ 
var size = 0; 
var entry = new Object(); 
this.add = function (key , value) 
{ 
if(!this.containsKey(key)) 
{ 
size ++ ; 
} 
entry[key] = value; 
} 
this.getValue = function (key) 
{ 
return this.containsKey(key) ? entry[key] : null; 
} 
this.remove = function ( key ) 
{ 
if( this.containsKey(key) && ( delete entry[key] ) ) 
{ 
size --; 
} 
} 
this.containsKey = function ( key ) 
{ 
return (key in entry); 
} 
this.containsValue = function ( value ) 
{ 
for(var prop in entry) 
{ 
if(entry[prop] == value) 
{ 
return true; 
} 
} 
return false; 
} 
this.getValues = function () 
{ 
var values = new Array(); 
for(var prop in entry) 
{ 
values.push(entry[prop]); 
} 
return values; 
} 
this.getKeys = function () 
{ 
var keys = new Array(); 
for(var prop in entry) 
{ 
keys.push(prop); 
} 
return keys; 
} 
this.getSize = function () 
{ 
return size; 
} 
this.clear = function () 
{ 
size = 0; 
entry = new Object(); 
} 
}
function MyObject(id,name) 
{ 
this.id = id; 
this.name = name; 
} 

var arrayObj =<?=$jsstr?>;
var c=new Array();
var map = new HashTable();
var _args=DWZ.jsonEval(arrayObj);
for(var key in _args){
    map.add(_args[key].id,_args[key].orgName); 
}

function gettreevalue(){
    
    var a=new Array();
    var b;
	var json = arguments[0], result="";
	$(json.items).each(function(i){
	   var _args=DWZ.jsonEval(this.value);
	    var cid=_args["id"];
	    if(this.chk==1){
	        map.add(cid,_args["orgName"]);   
	    }else{
            map.remove(cid);
	    }
	});
    b=map.getKeys();
    var j=0;
    for (var i in b) {
        key=b[i];
        a[j]='{"id":"'+key+'","orgName":"'+map.getValue(key)+'"}';
        j++;
    } 
   $("#resultBox").val("["+a.join(",")+"]");
   //$("#resultBox").val(a.join(","));
}
</script>